
#pragma once

#include "zdbmain.h"
#include "zAcGiEnvironment.h"
#include "zdbcolor.h"
#include "zAdAChar.h"

#pragma pack(push, 8)

#pragma warning( disable: 4275 4251 )

#ifdef SCENEDLLIMPEXP
#undef SCENEDLLIMPEXP
#endif
#ifdef SCENEOE
#define SCENEDLLIMPEXP __declspec( dllexport )
#else
#define SCENEDLLIMPEXP
#endif

const ZTCHAR UCDB_BACKGROUND_DICTIONARY[]  = UCRX_T("ACAD_BACKGROUND");

Ucad::ErrorStatus SCENEDLLIMPEXP getBackgroundDictionary   (UcDbDatabase* pDb, UcDbDictionary*& pDict,
                                             UcDb::OpenMode mode, bool createIfNonExist);
Ucad::ErrorStatus SCENEDLLIMPEXP getBackgroundDictionary   (UcDbDatabase* pDb, UcDbDictionary*& pDict,
                                             UcDb::OpenMode mode);

class UcDbImpBackground;

class SCENEDLLIMPEXP UcDbBackground : public UcDbObject
{
public:
    UCRX_DECLARE_MEMBERS(UcDbBackground);
    virtual ~UcDbBackground();
    virtual UcGiDrawable*  drawable ();

protected:
    UcDbBackground(UcDbImpBackground* pImp);
    UcDbImpBackground* imp() const;

private:
    friend class UcDbImpBackground;
    UcDbImpBackground* mpImp;
};

class SCENEDLLIMPEXP UcDbSolidBackground : public UcDbBackground
{
public:
    UCRX_DECLARE_MEMBERS(UcDbSolidBackground);
    UcDbSolidBackground();
    virtual ~UcDbSolidBackground();
    void            setColorSolid   (const UcCmEntityColor & color);
    UcCmEntityColor colorSolid      (void) const;
    virtual Ucad::ErrorStatus dwgInFields  (UcDbDwgFiler* pFiler);
    virtual Ucad::ErrorStatus dwgOutFields (UcDbDwgFiler* pFiler) const;
    virtual Ucad::ErrorStatus dxfInFields  (UcDbDxfFiler* pFiler);
    virtual Ucad::ErrorStatus dxfOutFields (UcDbDxfFiler* pFiler) const;

    virtual Ucad::ErrorStatus copyFrom     (const UcRxObject* other);
    virtual ZSoft::UInt32  setAttributes (UcGiDrawableTraits* pTraits);
    virtual UcGiDrawable::DrawableType    drawableType() const;

private:
    friend class UcDbImpSolidBackground;
};

class SCENEDLLIMPEXP UcDbGradientBackground : public UcDbBackground
{
public:
    UCRX_DECLARE_MEMBERS(UcDbGradientBackground);
    UcDbGradientBackground();
    virtual ~UcDbGradientBackground();
    void            setColorTop    (const UcCmEntityColor & color);
    UcCmEntityColor colorTop       (void) const;
    void            setColorMiddle (const UcCmEntityColor & color);
    UcCmEntityColor colorMiddle    (void) const;
    void            setColorBottom (const UcCmEntityColor & color);
    UcCmEntityColor colorBottom    (void) const;
    void            setHorizon     (double horizon);
    double          horizon        (void) const;
    void            setHeight      (double height);
    double          height         (void) const ;
    void            setRotation    (double rotation);
    double          rotation       (void) const;
    virtual Ucad::ErrorStatus dwgInFields  (UcDbDwgFiler* pFiler);
    virtual Ucad::ErrorStatus dwgOutFields (UcDbDwgFiler* pFiler) const;
    virtual Ucad::ErrorStatus dxfInFields  (UcDbDxfFiler* pFiler);
    virtual Ucad::ErrorStatus dxfOutFields (UcDbDxfFiler* pFiler) const;

    virtual Ucad::ErrorStatus copyFrom     (const UcRxObject* other);
    virtual ZSoft::UInt32  setAttributes (UcGiDrawableTraits* pTraits);
    virtual UcGiDrawable::DrawableType    drawableType() const;

private:
    friend class UcDbImpGradientBackground;
};

class SCENEDLLIMPEXP UcDbImageBackground : public UcDbBackground
{
public:

    UCRX_DECLARE_MEMBERS(UcDbImageBackground);
    UcDbImageBackground();
    virtual ~UcDbImageBackground();
    void            setImageFilename        (const ZTCHAR* filename);
    const ZTCHAR *   imageFilename           (void) const;
    void            setFitToScreen          (bool bFitToScreen);
    bool            fitToScreen             (void) const;
    void            setMaintainAspectRatio  (bool bMaintainAspectRatio);
    bool            maintainAspectRatio     (void) const;
    void            setUseTiling            (bool bUseTiling);
    bool            useTiling               (void) const;
    void            setXOffset              (double xOffset);
    double          xOffset                 (void) const;
    void            setYOffset              (double yOffset);
    double          yOffset                 (void) const;
    void            setXScale               (double xScale);
    double          xScale                  (void) const;
    void            setYScale               (double yScale);
    double          yScale                  (void) const;
    virtual Ucad::ErrorStatus dwgInFields  (UcDbDwgFiler* pFiler);
    virtual Ucad::ErrorStatus dwgOutFields (UcDbDwgFiler* pFiler) const;
    virtual Ucad::ErrorStatus dxfInFields  (UcDbDxfFiler* pFiler);
    virtual Ucad::ErrorStatus dxfOutFields (UcDbDxfFiler* pFiler) const;

    virtual Ucad::ErrorStatus copyFrom     (const UcRxObject* other);
    virtual ZSoft::UInt32  setAttributes (UcGiDrawableTraits* pTraits);
    virtual UcGiDrawable::DrawableType    drawableType() const;

private:
    friend class UcDbImpImageBackground;
};

class SCENEDLLIMPEXP UcDbGroundPlaneBackground : public UcDbBackground
{
public:
    UCRX_DECLARE_MEMBERS(UcDbGroundPlaneBackground);
    UcDbGroundPlaneBackground();
    virtual ~UcDbGroundPlaneBackground();
    void            setColorSkyZenith       (const UcCmEntityColor & color);
    UcCmEntityColor colorSkyZenith          (void) const;
    void            setColorSkyHorizon      (const UcCmEntityColor & color);
    UcCmEntityColor colorSkyHorizon         (void) const;
    void            setColorUndergroundHorizon  (const UcCmEntityColor & color);
    UcCmEntityColor colorUndergroundHorizon     (void) const;
    void            setColorUndergroundAzimuth  (const UcCmEntityColor & color);
    UcCmEntityColor colorUndergroundAzimuth     (void) const;
    void            setColorGroundPlaneNear (const UcCmEntityColor & color);
    UcCmEntityColor colorGroundPlaneNear    (void) const;
    void            setColorGroundPlaneFar  (const UcCmEntityColor & color);
    UcCmEntityColor colorGroundPlaneFar     (void) const;
    virtual Ucad::ErrorStatus dwgInFields  (UcDbDwgFiler* pFiler);
    virtual Ucad::ErrorStatus dwgOutFields (UcDbDwgFiler* pFiler) const;
    virtual Ucad::ErrorStatus dxfInFields  (UcDbDxfFiler* pFiler);
    virtual Ucad::ErrorStatus dxfOutFields (UcDbDxfFiler* pFiler) const;

    virtual Ucad::ErrorStatus copyFrom     (const UcRxObject* other);
    virtual ZSoft::UInt32  setAttributes (UcGiDrawableTraits* pTraits);
    virtual UcGiDrawable::DrawableType    drawableType() const;

private:
    friend class UcDbImpGroundPlaneBackground;
};

class SCENEDLLIMPEXP UcDbSkyBackground : public UcDbBackground
{
public:
    UCRX_DECLARE_MEMBERS(UcDbSkyBackground);
    UcDbSkyBackground();
    virtual ~UcDbSkyBackground();
    Ucad::ErrorStatus         setSunId     (UcDbObjectId sunId);
    UcDbObjectId              sunId        (void) const;
    virtual Ucad::ErrorStatus dwgInFields  (UcDbDwgFiler* pFiler);
    virtual Ucad::ErrorStatus dwgOutFields (UcDbDwgFiler* pFiler) const;
    virtual Ucad::ErrorStatus dxfInFields  (UcDbDxfFiler* pFiler);
    virtual Ucad::ErrorStatus dxfOutFields (UcDbDxfFiler* pFiler) const;

    virtual Ucad::ErrorStatus copyFrom     (const UcRxObject* other);
    virtual ZSoft::UInt32  setAttributes (UcGiDrawableTraits* pTraits);
    virtual UcGiDrawable::DrawableType    drawableType() const;

private:
    friend class UcDbImpSkyBackground;
};

#pragma pack (pop)
